package com.meituan.dao;

import com.meituan.pojo.entity.Goods;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

@Mapper
public interface GoodsDao extends JpaRepository<Goods, Integer> {

    @Query(value = "SELECT g.* FROM stores s, goods g,stores_goods sg WHERE s.sid = sg.sid AND sg.gid = g.gid AND g.state=1 AND s.sid = ?1",nativeQuery = true)
    List<Goods> findBySid(Integer sid);

}
